/*
 * Copyright 2009 Lukasz Wozniak
 * Licensed under the Apache License, Version 2.0 (the "License"); 
 * you may not use this file except in compliance with the License. 
 * You may obtain a copy of the License at 
 *
 * http://www.apache.org/licenses/LICENSE-2.0 
 *
 * Unless required by applicable law or agreed to in writing, software 
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and 
 * limitations under the License.
 */
package pl.sind.blip.entities;

import org.json.JSONException;
import org.json.JSONObject;

public class Avatar extends Multimedia {
	
	private String url15;
	private String url30;
	private String url50;
	private String url90;
	private String url120;
	
	public Avatar(JSONObject jsonObject) throws JSONException {
		super(jsonObject);
		url15 = jsonObject.optString("url_15");
		url30 = jsonObject.optString("url_30");
		url50 = jsonObject.optString("url_50");
		url90 = jsonObject.optString("url_90");
		url120 = jsonObject.optString("url_120");
	}
	
	public Avatar(){
	}

	public String getUrl15() {
		return url15;
	}

	public void setUrl15(String url15) {
		this.url15 = url15;
	}

	public String getUrl30() {
		return url30;
	}

	public void setUrl30(String url30) {
		this.url30 = url30;
	}

	public String getUrl50() {
		return url50;
	}

	public void setUrl50(String url50) {
		this.url50 = url50;
	}

	public String getUrl90() {
		return url90;
	}

	public void setUrl90(String url90) {
		this.url90 = url90;
	}

	public String getUrl120() {
		return url120;
	}

	public void setUrl120(String url120) {
		this.url120 = url120;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = super.hashCode();
		result = prime * result + ((url120 == null) ? 0 : url120.hashCode());
		result = prime * result + ((url15 == null) ? 0 : url15.hashCode());
		result = prime * result + ((url30 == null) ? 0 : url30.hashCode());
		result = prime * result + ((url50 == null) ? 0 : url50.hashCode());
		result = prime * result + ((url90 == null) ? 0 : url90.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (!super.equals(obj))
			return false;
		if (getClass() != obj.getClass())
			return false;
		Avatar other = (Avatar) obj;
		if (url120 == null) {
			if (other.url120 != null)
				return false;
		} else if (!url120.equals(other.url120))
			return false;
		if (url15 == null) {
			if (other.url15 != null)
				return false;
		} else if (!url15.equals(other.url15))
			return false;
		if (url30 == null) {
			if (other.url30 != null)
				return false;
		} else if (!url30.equals(other.url30))
			return false;
		if (url50 == null) {
			if (other.url50 != null)
				return false;
		} else if (!url50.equals(other.url50))
			return false;
		if (url90 == null) {
			if (other.url90 != null)
				return false;
		} else if (!url90.equals(other.url90))
			return false;
		return true;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append(Avatar.class.getName()).append("{");
		sb.append(super.toString());
		sb.append("url15: ").append(url15);
		sb.append(", url30: ").append(url30);
		sb.append(", url50: ").append(url50);
		sb.append(", url90: ").append(url90);
		sb.append(", url120: ").append(url120);
		sb.append(" }");
		return sb.toString();
	}
}
